<template>
  <el-col :span="24" class="virtualData">
    <!-- {{nums}} -->
    <el-row :gutter="24" class="virtualData-title">
      <el-col :span="8">
        <div class="grid-content bg-purple"></div>
        <el-input v-model="combinationId" placeholder="请输入内容"></el-input>
      </el-col>
      <el-col :span="8">
        <div class="grid-content bg-purple"></div>
        <el-button type="primary" icon="el-icon-search" @click="getData">搜索</el-button>
      </el-col>
    </el-row>
    <el-col :span="18" v-if="nums.length">
      <el-form ref="form" label-width="80px">
        <el-form-item :label="item.des" v-for="(item,index) in nums" :key="item+index">
          <el-input v-model="item.value"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">修改</el-button>
        </el-form-item>
      </el-form>
    </el-col>
  </el-col>
</template>
<script>
export default {
	data() {
		return {
			nums: [],
			list: [],
			val: 'ccccc',
			combinationId: '',
		};
	},
	computed: {},
	mounted() {
		// this.init();
	},
	methods: {
		getData() {
			this.$http('/admin/active/getVirtualData', {
				combinationId: this.combinationId,
			}).then(res => {
        console.log('%c gc_res=>: ','color: MidnightBlue; background: Aquamarine; font-size: 20px;',res);
				// console.log(res);
				this.nums = res.data.nums;
				this.list = res.data.list;
				this.redisKey = res.data.redisKey;
				// this.tableData = res.data;
				// this.imgView = this.tableData[0].photo_path;
			});
		},
		onSubmit() {

      console.log('%c gc_this.list=>: ','color: MidnightBlue; background: Aquamarine; font-size: 20px;',this.list);
			this.$http('/admin/active/modifyVirtualData', {
				nums: this.nums,
        list: this.list,
				redisKey: this.redisKey,
			}).then(res => {
				console.log(res);
				if (res.code == 1000) {
					this.$message({
						message: '恭喜你，修改成功',
						type: 'success',
					});
				}
				// this.nums = res.data.nums;
				// this.tableData = res.data;
				// this.imgView = this.tableData[0].photo_path;
			});
		},
	},
};
</script>
<style lang="scss">
.virtualData {
	padding: 30px !important;
	.virtualData-title {
		margin-bottom: 20px;
	}
}
</style>


